package com.pattern.singleton.register;

import com.pattern.utils.ThreadPoolUtils;

/**
 * Description
 *
 * @author hubiao
 * @since 2020-08-23 17:15
 */
public class ContainerSingletonTest {

    public static void main(String[] args) {
        //使用线程池来测试并发创建对象，测试容器单例模式
        try {
            ThreadPoolUtils.execute( new Runnable() {
                @Override
                public void run() {
                    Object object = ContainerSingleton.getBean( "com.pattern.singleton.register.User" );
                    System.out.println( Thread.currentThread().getName() + ":" + object.toString() );
                }
            } );

        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
